package com.ruoyi.system.service.api.patient.impl;

import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.system.domain.api.patient.GroupDto;
import com.ruoyi.system.domain.api.patient.PatientInfoDto;
import com.ruoyi.system.domain.api.patient.RelationDao;
import com.ruoyi.system.domain.api.patient.RelationshipDto;
import com.ruoyi.system.mapper.api.patient.GroupApiMapper;
import com.ruoyi.system.mapper.api.patient.RelationshipApiMapper;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.api.patient.IPatientApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class PatientApiServiceImpl implements IPatientApiService {
    @Autowired
    private RelationshipApiMapper relationshipApiMapper;

    @Autowired
    private ISysDictDataService sysDictDataService;

    private static final Logger log = LoggerFactory.getLogger(PatientApiServiceImpl.class);

    /**
     * 通过医生ID获取绑定关系列表
     *
     * @author sergio
     * @date 2024/11/15
     */
    @Override
    public List<PatientInfoDto> getPatientInfoByDoctorId(RelationshipDto relationshipDto) {
        // 仅返回关注和问诊的患者
        RelationDao relationDao = new RelationDao();
        relationDao.setDoctorId(relationshipDto.DoctorInfo.getDoctorId());
        relationDao.setConsultation(sysDictDataService.selectDictDataById(141L).getDictValue());
        relationDao.setRelation(sysDictDataService.selectDictDataById(138L).getDictValue());
        relationDao.setBlocked(sysDictDataService.selectDictDataById(140L).getDictValue());
        relationDao.setPageNum(relationshipDto.getPageNum());
        relationDao.setPageSize(relationshipDto.getPageSize());
        return relationshipApiMapper.selectPatientInfoByDoctorId(relationDao);
    }
}
